package com.telnetnz.ticketdesk.dao.wrapper;

import java.util.List;

import net.sf.ehcache.Cache;

import com.rockbb.common.dao.CacheManagerBean;
import com.telnetnz.ticketdesk.dao.entity.TagEntity;
import com.telnetnz.ticketdesk.dao.mapper.TagMapper;

public class TagWrap {

	private TagMapper mapper;
	private Cache cache;

	public TagWrap() {}

	public TagWrap(
			TagMapper mapper, 
			CacheManagerBean cacheManagerBean) {
		this.mapper = mapper;
		this.cache = cacheManagerBean.get(mapper.getClass().getName());
	}

	public TagEntity select(long id) {
		return mapper.select(id);
	}

	public long selectByName(String name) {
		Long id = mapper.selectByName(name);
		return (id == null)? 0L : id;
	}

	public List<Long> selectAllTags() {
		return mapper.selectAllTags();
	}

	public long countAll() {
		return mapper.countAll();
	}

	public void insert(TagEntity entity) {
		mapper.insert(entity);
	}

	public void update(TagEntity entity) {
		mapper.update(entity);
	}

	public void delete(TagEntity entity){
		mapper.delete(entity);
	}

	public void deleteByPrimaryKey(long id) {
		mapper.deleteByPrimaryKey(id);
	}

	public Cache getCache() 
	{
		return cache;
	}
}

